package com.zrspring.libv2.view.adview;

//import com.facebook.drawee.generic.GenericDraweeHierarchy;

import android.content.Context;
import android.view.View;

import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.common.ResizeOptions;
import com.zrspring.libv2.R;
import com.zrspring.libv2.fresco.PipelineDraweeControllerHelper;
import com.zrspring.libv2.view.adview.core.BaseHolder;


//import android.widget.LinearLayout;
//import android.widget.LinearLayout.LayoutParams;


/**
* @Encoding:UTF-8
* @ClassName: ADImageViewHolder
* @Description: TODO 图片加载的处理放到此类来处理
* @author 请填写作者名
* @date 2015年9月30日 上午10:45:42
* @ConputerUserName zrspring
*/

public class ADImageViewHolder implements BaseHolder {

	private SimpleDraweeView mView;
	private ResizeOptions options;
	
	@Override
	public View createView(Context context) {
		options = new ResizeOptions(640,240);
		mView = new SimpleDraweeView(context);
		mView.getHierarchy().setActualImageScaleType(ScalingUtils.ScaleType.FIT_XY);
		mView.getHierarchy().setPlaceholderImage(R.drawable.lib_no_img);
//		mView.setAspectRatio(1.0f);
		return mView;
	}

	@Override
	public void updateUI(Context context, final int position, final ADViewEntity adItem) {
		//加载图片
		mView.setController(PipelineDraweeControllerHelper.getController(adItem.getImgUrl(),mView,options));
//		mView.setImageURI(Uri.parse(adItem.getImgUrl()));
	}
}